Release 10.1A: OpenEdge Data Management:
DataServer for ODBC
Record creation
Record creation is handled differently for OpenEdge databases and ODBC data sources accessed through the DataServer. The difference occurs because Progress 4GL code run against an OpenEdge database follows different record-scoping rules than 4GL code run against an ODBC data source. The code fragments in this section illustrate these differences.
Suppose that you have a table called cust with a field called
cust-numthat is defined as an indexed field, and you write the following procedure:
When you run this procedure:
- The OpenEdge database does not create the record at the
CREATEstatement. Instead, it is written to the database at the end of the record scope or when the index information is supplied, whichever occurs first. In this example, the OpenEdge application writes the record after executing the statementcust-num = 10.- The DataServer writes the record at the end of the record scope. In this example, it writes the record after executing the statement
END.The following procedure also illustrates the differences between the OpenEdge database and DataServer record creation:
In this procedure, the code creates a
customer, setscust-numequal to 111, then finds and displays thecustomerrecord usingcust-num(the unique index). In this case:To get a consistent response from the DataServer, use this procedure instead:
The
Note: If you set the default value when creating a record, you must change the value before you create another record with the default value if the field is part of a unique key. Otherwise, the second record will cause a duplicate key.VALIDATEorRELEASEstatement causes the DataServer to write thecustomer111 record to the database before theFINDstatement occurs.Record updates are handled similarly to record creation. A record is updated in an ODBC data source at the end of record scope or at the end of a transaction, whichever comes first. For example, when you run the following procedure, the newly updated record is not found:
To send the record to the data source sooner, use the
VALIDATEstatement, as follows:
For more information about record scoping and transaction behavior, see the OpenEdge Development: Progress 4GL Handbook .
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |